<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title>发布学校通知</title>

	<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
	<link rel="stylesheet" href="css/classes_notice_item.css">
	<link rel="stylesheet" href="../css/main.css">
</head>

<body>

	<div id="container">
		<div class="header">
			<div class="header_title">发布学校通知</div>
			<a onclick="history.back()">
				<img src="../image/return.png" alt="" class="return">
			</a>
		</div>
		<div style="height: 40px;"></div>
		<div class="content" id="vue-root">
			<div class="ui-select">
				<select class="classes" v-model="notice.receiver">
					<option :value="undefined" disabled="disabled">请选择接收对象</option>
					<option :value="0">全校师生</option>
					<option :value="1">全校教师</option>
					<option :value="2">全校学生</option>
				</select>
			</div>
			<input placeholder="请输入通知标题" class="content_title" v-model="notice.title">

			<input placeholder="请输入发布者" class="content_title" v-model="notice.publisher">

			<!-- <div class="photo" v-if="notice.pic">
				<img :src="getImg(notice.pic)" class="notice_img">
			</div>

			<form id="form" method="post" ref="form" enctype="multipart/form-data" style="display: none">
				<input type="file" id="file" name="file" ref="file" accept="image/*" @change="upload">
			</form>

			<div class="File">
				<label @click="chooseImg">
					<img class="upload-img" src="../image/upload.png">
				</label>
			</div>

			<textarea placeholder="请输入具体内容" class="content_text" v-model="notice.content"></textarea> -->

			<div class="content_text">
				<editor :init="init" v-model="notice.content" />
			</div>

			<input type="button" class="content_info2" value="发布" @click="submit">
		</div>

	</div>

	<script src="/scriptZIP/vue.min.js"></script>
	<script src="/scriptZIP/axios.min.js"></script>

	<script src="/scriptZIP/tinymce.min.js"></script>
	<script src="/lib/tinymce-vue.min.js"></script>
	<script src="/js/tinymce_image_plugin.js"></script>

	

	<script src="/wechat/js/wx.js"></script>
	<script src="/js/common.js"></script>
	<script>

		var teacher = getTeacher();

		var schoolId = teacher.schoolId;
		var field = 'notice';

		// tinymceInit.theme = 'mobile';

		var app = new Vue({
			el: '#vue-root',
			components: {
				editor: Editor
			},
			data: {
				notice: {
					pic: null
				},
				init: tinymceInit
			},
			created: function () { },
			methods: {

				submit: function () {
					if (this.notice.receiver === undefined) {
						alert('请选择接收对象');
						return;
					}
					if (!confirm('确认提交？')) return;
					this.notice.text = getText(this.notice.content);
					axios.post('/t/notice', this.notice).then(function (res) {
						alert('发布成功');
						history.back();
					});
				},

			}
		});


	</script>

</body>

</html>